﻿using System;

namespace CustomWindows
{
    public class Event
    {
		#region Fields (3) 

        private readonly string _action;
        private readonly IntPtr _hwnd;
        private readonly DateTime _timeofEvent;

		#endregion Fields 

		#region Constructors (1) 

        public Event( DateTime timeOfEvent, IntPtr hwnd, string action )
        {
            _timeofEvent = timeOfEvent;
            _hwnd = hwnd;
            _action = action;
        }

		#endregion Constructors 

		#region Methods (1) 

		// Public Methods (1) 

        public override string ToString()
        {
            var windowsProcess = Helpers.GetProcess(_hwnd);
            return String.Format(String.Format("[{0}] {1}: {2}."
                , _timeofEvent
                , windowsProcess == null ? "Unknown" : windowsProcess.MainWindowTitle
                , _action));
        }

		#endregion Methods 
    }
}
